﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PickExperts2.Class;
using PluginInterFace;
using PickExperts2.control;

namespace PickExperts2.form
{
    public partial class fmHistory : Form
    {
        public fmHistory()
        {
            InitializeComponent();
        }

        private void fmHistory_Load(object sender, EventArgs e)
        {
            Init("");
        }

        private void Init(string tmp)
        {
            PluginInterFace.BLL.ssq bSsq = new PluginInterFace.BLL.ssq();
            Class.main cm = new main();
            cm.showWaitForm();
            rowMergeView1.DataSource = bSsq.GetList(tmp).Tables[0].DefaultView;
            rowMergeView1.ColumnHeadersHeight = 40;
            rowMergeView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            rowMergeView1.AddSpanHeader(2, 7, "开奖结果");
            //
            rowMergeView1.Columns[1].DefaultCellStyle.BackColor = Color.Yellow;
            rowMergeView1.Columns[2].DefaultCellStyle.BackColor = Color.Red;
            rowMergeView1.Columns[3].DefaultCellStyle.BackColor = Color.Red;
            rowMergeView1.Columns[4].DefaultCellStyle.BackColor = Color.Red;
            rowMergeView1.Columns[5].DefaultCellStyle.BackColor = Color.Red;
            rowMergeView1.Columns[6].DefaultCellStyle.BackColor = Color.Red;
            rowMergeView1.Columns[7].DefaultCellStyle.BackColor = Color.Red;
            rowMergeView1.Columns[8].DefaultCellStyle.BackColor = Color.Blue;
            cm.closeWaitForm();
        }

        private void 添加记录ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fmAddData fa = new fmAddData();
            if(fa.ShowDialog()==DialogResult.OK)
            {
                Init("");
            }
        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if(e.KeyChar==13)
            {
                if(textBox1.Text=="")
                    Init("");
                else
                {
                    Init(string.Format(" 期号 LIKE '%{0}' ",textBox1.Text));
                }
            }
        }
    }
}
